<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class tanggal_model extends CI_Model
{
    
    function __construct()
    {
       parent::__construct();
		$this->CI = get_instance();
    }//end of function

    function add_tanggal($data){
        
        $this->db->insert('TANGGAL',$data);
        
    }//end of function
    
    function edit_tanggal($idtanggal,$data){
        
        $this->db->where('IDTANGGAL',$idtanggal);
        $this->db->update('TANGGAL',$data);        
        
    }//end of function
    
    function get_tanggal(){
        
        $this->db->select('*');
        $this->db->from('TANGGAL');
        $this->db->where('STATUS > 0');
        $query = $this->db->get();
        return $query;        
        
    }//end of function
    
	function get_tanggalID($id_tanggal){
		$this->db->select('*');
		$this->db->from('TANGGAL');
		$this->db->where('IDTANGGAL',$id_tanggal);
		$query = $this->db->get();
		return $query;
	}
	
	function get_tanggal_grid(){	
		$this->db->select('*');
		$this->db->from('TANGGAL');
		$this->db->where("STATUS > 0 ");
		$this->CI->flexigrid->build_query();
		
		$return['records'] = $this->db->get();
		
		$this->db->select('*');
		$this->db->from('TANGGAL');
		$this->db->where("STATUS > 0 ");
		$this->CI->flexigrid->build_query(FALSE);
		
		$return['record_count'] = $this->db->count_all_results();

		return $return;
	}
	
}//end of class